package main

func Rotate(arr []int, r int) []int {
	res := make([]int, len(arr))
	length := len(arr)
	for i, item := range arr {
		pos := i + r
		if i+r >= len(arr) {
			pos = i + r - length
		}
		res[pos] = item
	}
	return res
}
